package cmd

import (
	"fmt"

	"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
	Use:   "hbr",
	Short: "He3DB backup&restore",
	Long:  "Welcome to use hbr for He3DB backup&restore",
	Run:   runRoot,
}

func init() {
	rootCmd.PersistentFlags().String("access_key", "", "S3 Access Key")
	rootCmd.PersistentFlags().String("secret_key", "", "S3 Secret Key")
	rootCmd.PersistentFlags().String("endpoint", "", "S3 endpoint")
	rootCmd.PersistentFlags().String("region", "", "S3 region")
	rootCmd.PersistentFlags().String("bucket", "", "S3 bucket")
	rootCmd.PersistentFlags().String("pd", "http://127.0.0.1:2379", "Tikv placement driber")
	rootCmd.PersistentFlags().String("name", "", "Backup name")
	rootCmd.PersistentFlags().String("archive_start_file", "000000010000000000000001", "start key of archive[included]")
}

func Execute() {
	if err := rootCmd.Execute(); err != nil {
		panic(err)
	}
}

func runRoot(cmd *cobra.Command, args []string) {
	fmt.Printf("Welcome to use hbr for He3DB backup&restore\n")
}
